<?php
	include "configure.php";
	
	htmlhead("117元件管理系统");
	
	addjs("control.js");
	
	htmlheadend();
	
?>
	<img src="css/pic/logo.jpg" /><br>
	<a href='addcomp.php' title='添加元件' class='yage_button'>添加</a>
	<a href='inport.php' title='导入csv文件' class='yage_button'>导入</a>
	<a href="export.php" title="导出csv文件" class="yage_button">导出</a>
	
<?php
	$query = "select components.uid,components.name,value,unit,num,position,description,comptype.name as type from components,comptype where components.type = comptype.uid";
	$result = mysql_query($query);
	echo "<div><table>";
	echo "<tr>";
	echo "<td>元件名</td><td>元件类型</td><td>值</td><td>单位</td><td>数量</td><td>保管位置（保管人）</td><td>描述</td>";
	echo "</tr>";
	while ($row=mysql_fetch_array($result)) {
		echo "<tr class=\"component\" value=\"$row[uid]\" title=\"$row[description]\">";
		echo "<td class=\"name\">$row[name]</td><td class=\"type\">$row[type]</td><td class=\"value\">$row[value]</td><td class=\"unit\">$row[unit]</td><td class=\"num\">$row[num]<input type=\"button\" class=\"comPlus yage_button\" value=\"+\" /><input type=\"button\" class=\"yage_button comMinus\" value=\"-\" /></td><td class=\"position\">$row[position]</td><td class=\"description\">$row[description]</td>";
		echo "</tr>";
	}
	echo "</table></div>";
?>

<?php
	$chars = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
	echo "<div id=\"comboxtable\"><table>";
	for($i=0;$i<15;$i++) {
		echo "<tr>";
		for($j=0;$j<15;$j++) {
			echo "<td class=\"box\" id=\"" . $chars[$j] . (15-$i) . "\">" . $chars[$j] . (15-$i) . "</td>";
		}
		echo "</tr>";
	}
	echo "</table></div>";
?>

<?php 
	htmltail();
?>